package strategies;

import dao.*;
import general.IContext;

/**
 *
 * @author Alejandro
 */
public class CreateDAOStrategy extends AbstractStrategy {

    @Override
    public void executeOperation(IContext context) {
        prepareContext(context);
        if (pp.getParamMap().containsKey("table-selection")) {
            int value = Integer.parseInt(pp.getParam("table-selection"));
            switch (value) {
                case 1:
                    op.echo("<h2>Employees</h2>");
                    ctx.setDAO(new EmployeeDAO());
                    break;
                case 2:
                    op.echo("<h2>Departments</h2>");
                    ctx.setDAO(new DepartmentDAO());
                    break;
                case 3:
                    op.echo("<h2>Countries</h2>");
                    ctx.setDAO(new CountryDAO());
                    break;
            }
        }
    }
}
